package pl.asoft.nbp.model;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;
import javax.persistence.Version;
import java.io.Serializable;

/**
 * Generic Superclass for Entity classes.
 * Created by rbiedrawa on 2014-12-02.
 */

@MappedSuperclass
public abstract class PersistentObject<E extends Serializable> implements Serializable {

    @Version
    @Column(name = "VER", nullable = false)
    protected long version = 0;

//    TODO: Create class that extends this and add basic auditing.
//    @Column(name = "MODIFIED_BY")
//    protected String modifiedBy;
//
//    @Column(name = "MODIFIED_TIME")
//    protected Date modifiedTime;

    @Transient
    public abstract E getId();


    public long getVersion() {
        return version;
    }

    public void setVersion(long version) {
        this.version = version;
    }

//    public void setModifiedBy(String modifiedBy) {
//        this.modifiedBy = modifiedBy;
//    }
//
//    public String getModifiedBy() {
//        return modifiedBy;
//    }
//
//    public void setModifiedTime(Date modifiedTime) {
//        this.modifiedTime = modifiedTime;
//    }
//
//    public Date getModifiedTime() {
//        return modifiedTime;
//    }
}
